<?php

namespace app\common\validate;

use think\Validate;

class Comment extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'user_id|用户' => 'require|number',
        'target_id|对象' => 'require|number',
        'store_id|商家' => 'require|number',
        'order_id|订单' => 'require|number',
        'star|星级' => 'require|number|between:1,5',
        'content|评论内容' => 'require|length:2,200',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'user_id.require' => '用户不能为空',
        'target_id.require' => '对象不能为空',
        'store_id.require' => '商家不能为空',
        'order_id.require' => '订单不能为空',
        'star.require' => '星级不能为空',
        'content.require' => '评论内容不能为空',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        //商品评价添加
        'goods_add'  => [
            'user_id',
            'target_id',
            'store_id',
            'order_id',
            'star',
            'content'
        ],
    ];
    
}
